package com.Q04;

/**
 * @version v1.0.0
 * 创建时间：2022/6/30 11:04
 */
public class PrimeSort {
    public static void main(String[] args) {
        PrimeSort primeSort = new PrimeSort();
        primeSort.numPrimeArrangements(100);
    }
    int SUPREMUM = 1000000007;
    public int numPrimeArrangements(int n) {
        //
        int notPrimeCount = 1;
        for(int i=2;i<=n;i++){
            for (int j=2;j*j<=i;j++){
                if (i%j==0){
                    notPrimeCount++;
                    break;
                }
            }
        }
        int primeCount = n - notPrimeCount;
        long aResult = getSortCount(primeCount);
        long bResult = getSortCount(notPrimeCount);
        int result = (int) ((aResult * bResult) % SUPREMUM);
        return result;
    }

    private long getSortCount(int n){
        long result =1;
        for (long i = 1; i <= n; i++) {
            result = (int)((result * i)%SUPREMUM);
        }
        return result;
    }
}
